import { globalIgnores } from 'eslint/config'
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript'
import pluginVue from 'eslint-plugin-vue'
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting'

// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
// import { configureVueProject } from '@vue/eslint-config-typescript'
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup

export default defineConfigWithVueTs(
  {
    name: 'app/files-to-lint',
    files: ['**/*.{ts,mts,tsx,vue}'],
  },

  globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),

  pluginVue.configs['flat/essential'],
  vueTsConfigs.recommended,
  skipFormatting,
  {
    rules: {
      "vue/attributes-order": ["error", {
        "order": [
          "DEFINITION",         // e.g. 'is', 'v-is'
          "LIST_RENDERING",     // 列表渲染（如 v-for）
          "CONDITIONALS",       // 条件渲染（如 v-if、v-else-if）
          "RENDER_MODIFIERS",   // 渲染修饰符（如 v-show、v-cloak）
          "GLOBAL",             // 全局属性（如 id、class）
          "UNIQUE", //e.g. 'ref', 'key'
          "SLOT",   // e.g. 'v-slot', 'slot'.
          "TWO_WAY_BINDING",    // 双向绑定（如 v-model）
          "OTHER_DIRECTIVES",   // e.g. 'v-custom-directive'
          "OTHER_ATTR", //alias for [ATTR_DYNAMIC, ATTR_STATIC, ATTR_SHORTHAND_BOOL]
          "EVENTS",             // 事件（如 @click、v-on）
          "CONTENT",        // 内容相关（如 v-text、v-html）
        ],
        "alphabetical": false   // 不强制按字母顺序排序
      }]
    }
  }
)
